Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: remove const qualifier for getMaterialInstances #6952

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

mackong
Copy link
Contributor

@mackong mackong commented Jul 13, 2023

With the const qualifier on the returned MaterialInstances, we cannot call setter functions like setDepthWrite etc. from the object, caused by

BindingError: Cannot convert argument of type MaterialInstance const* to parameter type MaterialInstance*

@romainguy romainguy added the internal Issue/PR does not affect clients label Jul 13, 2023
@@ -624,7 +624,7 @@ export class gltfio$FilamentInstance {
public getSkinNames(): Vector<string>;
public attachSkin(skinIndex: number, entity: Entity): void;
public detachSkin(skinIndex: number, entity: Entity): void;
public getMaterialInstances(): Vector<MaterialInstance>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change here? The other getters return a Vector<>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getMaterialVariantNames is wrapper by vectorToArray, which is convenient when iterate, so make this change to getMaterialInstances too.
What's the convention (vectorToArray or not) here, should all interfaces defined in filament.d.ts use Vector?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this consistent with the other APIs and continue to return a Vector<MaterialInstance>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, reverted.

@@ -624,7 +624,7 @@ export class gltfio$FilamentInstance {
public getSkinNames(): Vector<string>;
public attachSkin(skinIndex: number, entity: Entity): void;
public detachSkin(skinIndex: number, entity: Entity): void;
public getMaterialInstances(): Vector<MaterialInstance>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this consistent with the other APIs and continue to return a Vector<MaterialInstance>.

@mackong mackong force-pushed the fix/const-material-instance branch from 489bce1 to 97adec4 Compare July 19, 2023 11:47
@mackong mackong force-pushed the fix/const-material-instance branch from 97adec4 to 12d306b Compare July 19, 2023 11:54
@romainguy romainguy merged commit 0b60933 into google:main Jul 20, 2023
8 checks passed
@mackong mackong deleted the fix/const-material-instance branch September 4, 2023 12:19
plepers pushed a commit to plepers/filament that referenced this pull request Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants